import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: "/login",
  },
  {
    path: '/login',
    name: 'login',
    component: () => import("@/views/Login.vue")
  },
  {
    path: '/main',
    name: 'main',
    redirect: "/system/user/userList",
    component: () => import("@/views/Main.vue"),
    children: [
      {
        path: '/system/user/userList',
        name: 'userList',
        meta: {
          one: '系统管理',
          two: '用户管理',
        },
        component: () => import("@/views/system/user/userList.vue"),
      },
      {
        path: '/system/role/roleList',
        name: 'roleList',
        meta: {
          one: '系统管理',
          two: '角色管理',
        },
        component: () => import("@/views/system/role/roleList.vue"),
      },
      {
        path: '/system/menu/menuList',
        name: 'menuList',
        meta: {
          one: '系统管理',
          two: '菜单管理',
        },
        component: () => import("@/views/system/menu/menuList.vue"),
      },
      //shop部分
      {
        path: '/shop/banner/bannerList',
        name: 'bannerList',
        meta: {
          one: '商城管理',
          two: 'banner管理',
        },
        component: () => import("@/views/shop/banner/bannerList.vue"),
      },
      {
        path: '/shop/cart/cartList',
        name: 'cartList',
        meta: {
          one: '商城管理',
          two: '购物车管理',
        },
        component: () => import("@/views/shop/cart/cartList.vue"),
      },
      {
        path: '/shop/category/categoryList',
        name: 'categoryList',
        meta: {
          one: '商城管理',
          two: '分类管理',
        },
        component: () => import("@/views/shop/category/categoryList.vue"),
      },
      {
        path: '/shop/goods/goodsList',
        name: 'goodsList',
        meta: {
          one: '商城管理',
          two: '商品管理',
        },
        component: () => import("@/views/shop/goods/goodsList.vue"),
      },
      {
        path: '/shop/order/orderList',
        name: 'orderList',
        meta: {
          one: '商城管理',
          two: '订单管理',
        },
        component: () => import("@/views/shop/order/orderList.vue"),
      },
    ]
  },

]


//无token情况
// const routes = [
//   {
//     path: '/',
//     redirect: "/login",
//   },
//   {
//     path: '/login',
//     name: 'login',
//     component: () => import("@/views/Login.vue")
//   },
//   {
//     path: '/main',
//     name: 'main',
//     redirect: "/system/user/userList",
//     component: () => import("@/views/Main.vue"),
//     children: [
//       {
//         path: '/system/user/userList',
//         name: 'userList',
//         component: () => import("@/views/system/user/userList.vue"),
//       },
//       {
//         path: '/system/role/roleList',
//         name: 'roleList',
//         component: () => import("@/views/system/role/roleList.vue"),
//       },
//       {
//         path: '/system/menu/menuList',
//         name: 'menuList',
//         component: () => import("@/views/system/menu/menuList.vue"),
//       },
//       //shop部分
//       {
//         path: '/shop/banner/bannerList',
//         name: 'bannerList',
//         component: () => import("@/views/shop/banner/bannerList.vue"),
//       },
//       {
//         path: '/shop/cart/cartList',
//         name: 'cartList',
//         component: () => import("@/views/shop/cart/cartList.vue"),
//       },
//       {
//         path: '/shop/category/categoryList',
//         name: 'categoryList',
//         component: () => import("@/views/shop/category/categoryList.vue"),
//       },
//       {
//         path: '/shop/goods/goodsList',
//         name: 'goodsList',
//         component: () => import("@/views/shop/goods/goodsList.vue"),
//       },
//       {
//         path: '/shop/order/orderList',
//         name: 'orderList',
//         component: () => import("@/views/shop/order/orderList.vue"),
//       },
//     ]
//   },

// ]

const router = new VueRouter({
  routes
})

export default router
